home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 1
/
Atari Mega Archive - Volume 1.iso
/
gnu
/
fpu881
/
src6.zoo
/
sprintf.c
< prev
next >
Wrap
C/C++ Source or Header
|
1991-09-24
|
769b
|
44 lines
#define __SRC__
#include <stdarg.h>
#include <stdio.h>
#include <limits.h>
#if 0
static int sputc(c, s)
int c;
char **s;
{
return(*(*s)++ = c);
}
#endif
sprintf(buf, fmt, arg)
char *buf;
const char *fmt;
int arg;
{
register int n;
FILE sf =
{0L, (unsigned char *)buf, (unsigned char *)buf,
_IOWRT|_IOBIN|_IOSTRING|_IOFBF, 0, LONG_MAX,'\0'};
n = _doprnt(&sf, fmt, &arg);
*(sf._ptr) = '\0'; /* always tie of the string */
return(n);
}
vsprintf(buf, fmt, args)
char *buf;
const char *fmt;
va_list args;
{
register int n;
FILE sf =
{0L, (unsigned char *)buf, (unsigned char *)buf,
_IOWRT|_IOBIN|_IOSTRING|_IOFBF, 0, LONG_MAX,'\0'};
n = _doprnt(&sf, fmt, args);
*(sf._ptr) = '\0'; /* always tie of the string */
return(n);
}